package cn.terminus.data.customer.contractselldefyoverdueapplicationinfo.impl;

import cn.terminus.common.customer.bean.contractselldefyoverdueapplicationinfo.dto.*;
import cn.terminus.data.customer.contractselldefyoverdueapplicationinfo.dao.ContractSellDefyOverdueApplicationInfoDao;
import cn.terminus.data.customer.contractselldefyoverdueapplicationinfo.mapper.ContractSellDefyOverdueApplicationInfoMapper;
import cn.terminus.result.common.page.TerminusPageAble;
import cn.terminus.result.common.page.TerminusPageInfo;
import cn.terminus.result.common.util.BeanCopyUtils;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * 合同出售办证违约(ContractSellDefyOverdueApplicationInfo)表服务实现类
 *
 * @author makejava
 * @since 2021-07-21 11:18:32
 */
@Repository
public class ContractSellDefyOverdueApplicationInfoDaoImpl implements ContractSellDefyOverdueApplicationInfoDao {
    @Resource
    private ContractSellDefyOverdueApplicationInfoMapper contractSellDefyOverdueApplicationInfoMapper;

    @Override
    public Integer add(ContractSellDefyOverdueApplicationInfoNewDto dto) {
        return contractSellDefyOverdueApplicationInfoMapper.add(dto);
    }

    @Override
    public Integer update(ContractSellDefyOverdueApplicationInfoEditDto dto) {
        return contractSellDefyOverdueApplicationInfoMapper.update(dto);
    }

    @Override
    public List<ContractSellDefyOverdueApplicationInfoResultDto> gets(ContractSellDefyOverdueApplicationInfoGetsDto dto) {
        return contractSellDefyOverdueApplicationInfoMapper.gets(dto);
    }

    @Override
    public List<ContractSellDefyOverdueApplicationInfoResultDto> query(ContractSellDefyOverdueApplicationInfoQueryDto dto) {
        return contractSellDefyOverdueApplicationInfoMapper.query(dto);
    }

    @Override
    public Integer delete(ContractSellDefyOverdueApplicationInfoDeleteDto dto) {
        return contractSellDefyOverdueApplicationInfoMapper.delete(dto);
    }

    @Override
    public TerminusPageAble<ContractSellDefyOverdueApplicationInfoResultDto> page(ContractSellDefyOverdueApplicationInfoQueryDto dto, TerminusPageInfo page) {
        PageHelper.startPage(page.getCurrentPage(), page.getPageSize());
        Page<ContractSellDefyOverdueApplicationInfoResultDto> result = (Page<ContractSellDefyOverdueApplicationInfoResultDto>) contractSellDefyOverdueApplicationInfoMapper.query(dto);
        return new TerminusPageAble<>(BeanCopyUtils.copy(result.getResult(), ContractSellDefyOverdueApplicationInfoResultDto.class), page, result.getTotal());
    }

    @Override
    public Integer deleteWithContractId(Long id) {
        return contractSellDefyOverdueApplicationInfoMapper.deleteWithContractId(id);
    }
}
